/*******************************************************************************
 * Copyright (c) 2002, 2014 IBM Corp. and others
 *
 * This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License 2.0 which accompanies this
 * distribution and is available at https://www.eclipse.org/legal/epl-2.0/
 * or the Apache License, Version 2.0 which accompanies this distribution and
 * is available at https://www.apache.org/licenses/LICENSE-2.0.
 *
 * This Source Code may also be made available under the following
 * Secondary Licenses when the conditions for such availability set
 * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
 * General Public License, version 2 with the GNU Classpath
 * Exception [1] and GNU General Public License, version 2 with the
 * OpenJDK Assembly Exception [2].
 *
 * [1] https://www.gnu.org/software/classpath/license.html
 * [2] http://openjdk.java.net/legal/assembly-exception.html
 *
 * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
 *******************************************************************************/
#define true 1
#define false 0
#include "floatsanityg.h"


   void group_java_lang_Math_atan() {
      int i=0, groupNum=31,numTests=132;
      int testsPassed=0, testsFailed=0;
      unsigned int op_0 [] = {
         0x7ff80000, 0x00000000,
         0x0, 0x0,
         0x80000000, 0x00000000,
         0x7ff00000, 0x00000000,
         0xfff00000, 0x00000000,
         0x3fd58139, 0xf95ac4e8,
         0x3fd4d753, 0xca24770c,
         0x3fe1f1b5, 0xe2ee80f8,
         0x3fe49c30, 0xb7f0c2cd,
         0x3fe7d46b, 0xb0e4050c,
         0x3fc0e1f1, 0x09547674,
         0x3fd1a461, 0xa53076c8,
         0x3fe6d154, 0x187c4bbf,
         0x3fe7ba16, 0xf9d650c2,
         0x3fe8ff6c, 0x11a7fd62,
         0x3fda4581, 0x212ad2cc,
         0x3fd48eb0, 0xe8c22c3c,
         0x3fde27bd, 0x7edbf5f0,
         0x3fc04b98, 0xdca6b9ac,
         0x3fe1d234, 0x547f8161,
         0x3fe3af12, 0x8232e8e3,
         0x3fe8cf7c, 0xf31f38d8,
         0x3fe87105, 0x3cd8f2bf,
         0x3f932ffb, 0x96cf3360,
         0x3fb378cd, 0x50af46e8,
         0x3ff921f0, 0xd7e968a9,
         0xc01921fb, 0x54442d18,
         0x3ff921fb, 0x54442d1b,
         0xffefffff, 0xffffffff,
         0xffeccccc, 0xcccccccc,
         0xffe99999, 0x99999999,
         0xffe66666, 0x66666666,
         0xffe33333, 0x33333333,
         0xffe00000, 0x00000000,
         0xffd99999, 0x9999999a,
         0xffd33333, 0x33333334,
         0xffc99999, 0x9999999c,
         0xffb99999, 0x9999999f,
         0xfc980000, 0x00000000,
         0x7fb99999, 0x99999993,
         0x7fc99999, 0x99999996,
         0x7fd33333, 0x33333331,
         0x7fd99999, 0x99999997,
         0x7fdfffff, 0xfffffffd,
         0x7fe33333, 0x33333332,
         0x7fe66666, 0x66666665,
         0x7fe99999, 0x99999998,
         0x7feccccc, 0xcccccccb,
         0x7fefffff, 0xfffffffe,
         0xc32fc000, 0x00000000,
         0x7fefffff, 0xffffffff,
         0x0, 0x2,
         0x0, 0x9,
         0x40000, 0x00000000,
         0x80000, 0x00000000,
         0xfffff, 0xfffffffe,
         0xfffff, 0xffffffff,
         0x80000000, 0x00000002,
         0x80000000, 0x00000009,
         0x80040000, 0x00000000,
         0x80080000, 0x00000000,
         0x800fffff, 0xfffffffe,
         0x800fffff, 0xffffffff,
         0x408fb4e1, 0x47ae149b,
         0x4090961e, 0xb851eb95,
         0xc0863000, 0x00000000,
         0xc08627eb, 0x851eb852,
         0x4051ef5c, 0x28f5c132,
         0x3ff0a2b2, 0x3def12b7,
         0x3ff0a2b2, 0x3e33cae7,
         0x3ff0a2b2, 0x3f8b63d7,
         0xbfefffff, 0xffffffff,
         0x3fefffff, 0xfffffff0,
         0x3fefffff, 0xffffffff,
         0x3fefffff, 0xfffffe14,
         0xc0152c38, 0xc4e8043a,
         0xc014e48a, 0xb06d22f4,
         0xc014da4d, 0x3fc94bea,
         0xc010d00f, 0xcf2574f8,
         0xc0014e34, 0x192c3200,
         0x40124ea8, 0x82c60fb8,
         0x401258e5, 0xf369e6c2,
         0x4014e842, 0x1c5fa942,
         0xbff80d0c, 0x0962a17e,
         0xbff03601, 0xcbf1fda5,
         0x3ff111ac, 0x4888e3a9,
         0x3ff911ac, 0x4888e3ab,
         0x3fefced9, 0x1687291c,
         0x3fefe76c, 0x8b439398,
         0x3feff3b6, 0x45a1c8d6,
         0x3feff7ce, 0xd9168540,
         0xc014eec8, 0x2110f9fe,
         0x400d7e98, 0xb3a09a7b,
         0xc00295e2, 0x2da71340,
         0x3ffff2f3, 0xf69d5e8e,
         0x401058e5, 0xf369e6ce,
         0xc00e8167, 0x4c5f64e4,
         0x3fc6978d, 0x4fdf3b6a,
         0x3fd126e9, 0x78d4fdf8,
         0x3fd2978d, 0x4fdf3b69,
         0x3fd6a7ef, 0x9db22d14,
         0x3fd7c6a7, 0xef9db233,
         0x3fd7df3b, 0x645a1cb2,
         0x3fd820c4, 0x9ba5e35a,
         0x3fd98106, 0x24dd2f21,
         0x3fdbdf3b, 0x645a1cb3,
         0x3fdc20c4, 0x9ba5e35b,
         0x3fdc28f5, 0xc28f5c30,
         0x3fdcbc6a, 0x7ef9db2a,
         0x3fdf645a, 0x1cac0839,
         0x3fe00831, 0x26e978d8,
         0x3fe01cac, 0x083126ea,
         0x3fe0b439, 0x5810623c,
         0x3fe0bc6a, 0x7ef9db10,
         0x3fe1ba5e, 0x353f7cbc,
         0x3fe1c6a7, 0xef9db1fa,
         0x3fe1d2f1, 0xa9fbe738,
         0x3fe1d70a, 0x3d70a3a2,
         0x3fe21cac, 0x083126ac,
         0x3fe29ba5, 0xe353f782,
         0x3fe33f7c, 0xed916812,
         0x3fe38d4f, 0xdf3b63f0,
         0x3fe39168, 0x72b0205a,
         0x3fe39999, 0x9999992e,
         0x3fe40c49, 0xba5e34c6,
         0x3fe4e147, 0xae147a4e,
         0x3fe5ef9d, 0xb22d0da2,
         0x3fe651eb, 0x851eb792,
         0x3fe676c8, 0xb439574c,
         0x3fe81062, 0x4dd2f0b4,
         0x3fe84189, 0x374bc5ac,
         0x3feac083, 0x126e9644,
         0x0, 0x0};
      unsigned int result [] = {
         0x7ff80000, 0x00000000,
         0x0, 0x0,
         0x80000000, 0x00000000,
         0x3ff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0x3fd4bf08, 0x7919d602,
         0x3fd425e5, 0x2d374fd5,
         0x3fe05aa1, 0xa5894b1e,
         0x3fe24f66, 0xad79ca87,
         0x3fe47b99, 0x5947302a,
         0x3fc0c923, 0x504efb31,
         0x3fd136ef, 0x08337d8a,
         0x3fe3d264, 0x5a4493d5,
         0x3fe46aa2, 0x8b75a0f0,
         0x3fe53899, 0x9de9b836,
         0x3fd8eddf, 0x2887c7d5,
         0x3fd3e423, 0x37b1ca1e,
         0x3fdc2e41, 0xced1d1f8,
         0x3fc03546, 0xfc631ab9,
         0x3fe0429f, 0x7f115743,
         0x3fe1a597, 0x834bd750,
         0x3fe51abf, 0x4926751e,
         0x3fe4df6a, 0x9e1a792b,
         0x3f932f68, 0x74159f27,
         0x3fb36f38, 0xdfaea990,
         0x3ff00fe6, 0x81c0d759,
         0xbff69b81, 0x54baf42e,
         0x3ff00fe9, 0x87ed0300,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0xbff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0x3ff921fb, 0x54442d18,
         0xbff921fb, 0x54442d17,
         0x3ff921fb, 0x54442d18,
         0x0, 0x2,
         0x0, 0x9,
         0x40000, 0x00000000,
         0x80000, 0x00000000,
         0xfffff, 0xfffffffe,
         0xfffff, 0xffffffff,
         0x80000000, 0x00000002,
         0x80000000, 0x00000009,
         0x80040000, 0x00000000,
         0x80080000, 0x00000000,
         0x800fffff, 0xfffffffe,
         0x800fffff, 0xffffffff,
         0x3ff91df1, 0xda43d3f6,
         0x3ff91e1f, 0x88585ba6,
         0xbff91c36, 0x7668c617,
         0xbff91c34, 0x5bd0938e,
         0x3ff8e8e3, 0xf05ea8bb,
         0x3fe9c17d, 0x541a4926,
         0x3fe9c17d, 0x545c546e,
         0x3fe9c17d, 0x55a68cd4,
         0xbfe921fb, 0x54442d18,
         0x3fe921fb, 0x54442d10,
         0x3fe921fb, 0x54442d18,
         0x3fe921fb, 0x54442c22,
         0xbff6252b, 0xb146b6dd,
         0xbff61b29, 0x7d3e0e68,
         0xbff619b6, 0x0a9dc919,
         0xbff56544, 0xe5c56948,
         0xbff23455, 0x0150dc91,
         0x3ff5b0e2, 0x0963c5ff,
         0x3ff5b2be, 0xd054172e,
         0x3ff61baf, 0xf67c4ec2,
         0xbfef7b10, 0x3625ad40,
         0xbfe957a2, 0x60b2a15b,
         0x3fea2ab7, 0x2541dbd3,
         0x3ff00b33, 0x45490851,
         0x3fe90954, 0xf6074d05,
         0x3fe915ac, 0xe0bb1511,
         0x3fe91bd5, 0x48f1009d,
         0x3fe91de2, 0x3a8c3eab,
         0xbff61c9b, 0x9147d9d9,
         0x3ff4e518, 0xff4ce0fd,
         0xbff2a112, 0x3ed9dc11,
         0x3ff1b444, 0xb6e6c70b,
         0x3ff54b0c, 0x28591dc2,
         0xbff50778, 0x69f71168,
         0x3fc65c97, 0xe08cdea8,
         0x3fd0c219, 0x0b4dad6c,
         0x3fd2180f, 0xa38984a5,
         0x3fd5c664, 0x27cc8a39,
         0x3fd6c3c4, 0x473a99d1,
         0x3fd6d95a, 0x07aa94a4,
         0x3fd712ce, 0xd0372601,
         0x3fd84504, 0xf26249fa,
         0x3fda4968, 0xaaa7e55e,
         0x3fda806a, 0x855ee4ea,
         0x3fda8747, 0xd793c3e1,
         0x3fdb0268, 0x9f44a796,
         0x3fdd2f69, 0x567bf2ee,
         0x3fddb981, 0x1f32abba,
         0x3fddda36, 0x9f7b42cc,
         0x3fdeca37, 0x66bc184a,
         0x3fded716, 0x3421b71c,
         0x3fe03068, 0x27ced1ed,
         0x3fe039cd, 0x9c4cbc50,
         0x3fe04330, 0x01104be7,
         0x3fe04650, 0x1f22e21e,
         0x3fe07b3e, 0x0d776c60,
         0x3fe0dac5, 0x7419630e,
         0x3fe15425, 0x572c198f,
         0x3fe18d0d, 0xcf91e414,
         0x3fe19009, 0x2c8e2487,
         0x3fe195fe, 0xe1a91f61,
         0x3fe1e8e0, 0x3e38c3a1,
         0x3fe2800b, 0xeadc1dc9,
         0x3fe33acd, 0x54bbb4de,
         0x3fe37d4e, 0x54fdfe2b,
         0x3fe3960d, 0x80ae2eb8,
         0x3fe4a209, 0x6a783ffb,
         0x3fe4c157, 0xe38ab1cc,
         0x3fe6482b, 0xe037cc0d,
         0x0, 0x0};
      double *p0=(double *) op_0;
      double *erp=(double*) result, r, *rp=&r;
      for (i=0; i<numTests; i++) {
         r = java_lang_Math_atan(*(p0));
         if ( IS_DNAN(erp) ){
            if ( !(IS_DNAN(&r)) ){
               printf("%d.%d: op_0=0x%08x%08x Expected=0x%08x%08x Actual=0x%08x%08x \n",
                  groupNum, i, 
                  *(int *)p0, *((int *)p0+1), *(int *)erp, *((int *) erp + 1), *(int *)&r, *((int *) &r + 1));
               testsFailed++;
            } else {
               testsPassed++;
            }

         } else {
            if (HIWORD(&r) != HIWORD(erp) || abs(LOWORD(&r) - LOWORD(erp)) > 1) {
               printf("%d.%d: op_0=0x%08x%08x Expected=0x%08x%08x Actual=0x%08x%08x \n",
                  groupNum, i, 
                  *(int *)p0, *((int *)p0+1), *(int *)erp, *((int *) erp + 1), *(int *)&r, *((int *) &r + 1));
               testsFailed++;
            } else {
               testsPassed++;
            }
         }

         p0++;erp++;
      }
      printf("[%d] %s Passed %d Failed %d Total %d \n", groupNum,"java_lang_Math_atan", testsPassed, testsFailed, numTests);
      totalNumTest +=numTests; totalTestsPassed +=testsPassed; totalTestsFailed +=testsFailed;
   }

